package com.da.javatest.niuke.jianzhi;

/**
 * @author chenlida
 * @date 2020/10/20 16:46
 * https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba?
 * tpId=13&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 */
public class C6Solution {
    public int minNumberInRotateArray(int[] array) {
        if (array.length == 0) {
            return 0;
        }
        int min = array[0];
        boolean flag = false;
        for (int i = 1; i < array.length; i++) {
            if (flag) {
                break;
            }
            if (array[i] < min) {
                min = array[i];
                flag = true;
            }
        }

        return min;
    }
}
